package com.kang;

import com.kang.commons.filter.CrossFilter;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;

/**
 * @program: Java_new_sql
 * @description:
 * @author: K.faWu
 * @create: 2021-06-15 17:28
 **/
@SpringBootApplication
@MapperScan(basePackages = "com.kang.mapper")
public class NewSqlApp {

    public static void main(String[] args) {
        SpringApplication.run(NewSqlApp.class, args);
    }

    @Bean
    public FilterRegistrationBean<CrossFilter> crossDomainFilter(){
        FilterRegistrationBean<CrossFilter> registrationBean =
                new FilterRegistrationBean<>();
        //web.xml中的filter
        registrationBean.setFilter(new CrossFilter());

        //web.xml 中的url-pattern
        registrationBean.addUrlPatterns("/*");
        return registrationBean;
    }
}
